<?php

	$_user_ip      = ( isset($_SERVER['REMOTE_ADDR']) )     ? $_SERVER['REMOTE_ADDR']     : "";
	$_user_id      = ( isset($_SESSION['user_id']) )        ? $_SESSION['user_id']        : "NULL";
	$_user_agent   = ( isset($_SERVER['HTTP_USER_AGENT']) ) ? $_SERVER['HTTP_USER_AGENT'] : "";
	$_request_time = mktime();
	
	$query = "insert into
	            requests
	          set
	            id      = NULL,
	            time    = '$_request_time',
	            ip      = '$_user_ip',
	            user_id = $_user_id,
	            agent   = '$_user_agent'";
	$db->query($query);
	        
	unset($_user_ip);
	unset($_user_id);
	unset($_user_agent);
	unset($_request_time);
	unset($query);
        
?>